package com.hbpu.encap.arrays;

public class Homework {
    public static void main(String[] args) {
        String str = "abcdef";
        String strReverse = reverse(str, 1, 5);
        System.out.println(strReverse);
    }

    public static String reverse(String str, int start, int end) {
        StringBuilder stringBuffer = new StringBuilder(str);
        String substring = stringBuffer.substring(start, end);
        StringBuilder stringBuffer1 = new StringBuilder(substring);
        stringBuffer1.reverse();
        String string = stringBuffer1.toString();
        stringBuffer.replace(start, end, string);
        return stringBuffer.toString();
    }
}
